package drongo.desktop.utils
{
	public class GUID
	{
		private static var devCode:String;
		private static var localNextId:Number = 0;
		public function GUID()
		{
		}
		public static function initLoaclID(id:Number):void{
			localNextId=id;
		}
		public static function get loaclID():Number{
			return localNextId;
		}
		public static function getNextId():String
		{
			if(devCode==null||devCode==""){
				initDevCode();
			}
			return devCode+(localNextId++).toString(36);
		}
		/**
		 * 启动时调用一次
		 */		
		public static function initDevCode():void{
			var count:int = 0;
			for(var i:int=0;i<4;i++)
			{
				var c:int = Math.random()*26;
				count += Math.pow(26, i)*(c+10);
			}
			count += int(Math.random()*1000000) + int(Math.random()*222640);
			devCode = count.toString(36);
		}
	}
}